<!--
 * @Author: your name
 * @Date: 2022-03-14 15:25:46
 * @LastEditTime: 2022-03-14 16:45:24
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \geyao\geyao\异步和同步转换220314.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>异步和同步转换</title>
</head>

<body>
  <script>
    
    async function fangfang() {
      return new Promise((resolve)=>{
        setTimeout(() => {
          resolve("我给你钱")
      },1000)
    })
  }

  function geyao() {
      return "我去买东西"
    }

   async function test() {
      let qian=await fangfang();
      let dongxi=await geyao();
      console.log(qian,"qian")
      console.log(dongxi,"dongxi")
    }

    test()
 


   
    
 
    
  </script>
</body>

</html>